package com.lgy.controller;

import com.github.pagehelper.PageInfo;
import com.lgy.pojo.Employee;
import com.lgy.pojo.Financing;
import com.lgy.service.IFinancingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/financing")
public class FinancingController {
    @Autowired
    private IFinancingService financingService;

    @RequestMapping("/getFinancingByCompanyId")
    public String getFinancingByCompanyId(Model model, HttpSession session, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "8")Integer pageSize){
        Employee emp = (Employee) session.getAttribute("emp");
        PageInfo<Financing> pageInfo = financingService.getFinancingByCompanyId(emp.getCompanyid(),page,pageSize);
        model.addAttribute("pageInfo",pageInfo);
        return "AdminReceiptList";
    }
}
